package example.demo.scheduling;

import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;

@Component
@Slf4j
public class SchedulingAnnoBean {

    private final DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");

    //https://cron.qqe2.com/
    @Scheduled(cron = "0/5 * * * * ? ")
    public void printCurrentDate() {
//        log.info("当前时间是----{}", dateFormat.format(new Date()));
    }
}
